integer

type integer

Represents a 64-bit signed integer

Since

0.6.0

Constructors

Link copied to clipboard
pure constructor(value: text, [radix: integer])

Parses a signed string representation of an integer.

pure constructor(value: decimal)

Converts a decimal to an integer, rounding towards 0.

Properties

Link copied to clipboard
val MAX_VALUE: integer = 9223372036854775807

A constant representing the maximum value an integer can have (9223372036854775807)

Link copied to clipboard
val MIN_VALUE: integer = -9223372036854775808

A constant representing the minimum value an integer can have (-9223372036854775808)

Functions

Link copied to clipboard
pure function abs(): integer

Calculates the absolute value of the integer.

Link copied to clipboard
pure static function from_hex(value: text): integer

Parses an unsigned hexadecimal representation of an integer.

Link copied to clipboard
pure static function from_text(value: text, [radix: integer]): integer

Parses a signed string representation of an integer.

Link copied to clipboard
(alias) pure function hex(): text

Converts this integer to a hexadecimal string.

Alias
Link copied to clipboard
pure function max(value: big_integer): big_integer

Finds the maximum of this integer and the given big integer value.

pure function max(value: decimal): decimal

Finds the maximum of this integer and the given decimal value.

pure function max(value: integer): integer

Finds the maximum of this integer and the given value.

Link copied to clipboard
pure function min(value: big_integer): big_integer

Finds the minimum of this integer and the given big integer value.

pure function min(value: decimal): decimal

Finds the minimum of this integer and the given decimal value.

pure function min(value: integer): integer

Finds the minimum of this integer and the given value.

Link copied to clipboard
(alias) pure static function parseHex(value: text): integer

Parses an unsigned hexadecimal representation of an integer.

Alias
Link copied to clipboard
pure function pow(exponent: integer): integer

Raises this integer to the power of the given exponent. Can be used in a database at-expression.

  1. The exponent cannot be negative.

  2. Error on overflow, if the result is out of integer or integer range.

  3. Beware that the result of integer.pow() is limited to the 64-bit signed integer range, so the operation like (2).pow(64) will overflow - use big_integer.pow() to get a big_integer result, e.g. (2).to_big_integer().pow(64).

  4. If the exponent is 0, the result is always 1; if the exponent is 1, the result is the original value.

Link copied to clipboard
pure function sign(): integer

Returns the sign of the integer: -1 if negative, 0 if zero, and 1 if positive.

Link copied to clipboard
(alias) pure function signum(): integer

Returns the sign of the integer: -1 if negative, 0 if zero, and 1 if positive.

Alias
Link copied to clipboard
(alias) pure function str(): text

Converts this integer to a text string.

Alias
(alias) pure function str(radix: integer): text

Converts this integer to a text string with the specified radix.

Alias
Link copied to clipboard
pure function to_big_integer(): big_integer

Converts this integer to a big integer.

Link copied to clipboard
pure function to_decimal(): decimal

Converts this integer to a decimal.

Link copied to clipboard
pure function to_hex(): text

Converts this integer to a hexadecimal string.

Link copied to clipboard
pure function to_text(): text

Converts this integer to a text string.

pure function to_text(radix: integer): text

Converts this integer to a text string with the specified radix.